package com.yingdong.message;

import java.util.Map;

import com.yingdong.db.Resource;
import com.yingdong.opcode.ServerOpcode;
import com.yingdong.sceneserver.inner.message.SendBaseMessage;

public class ResourceMessage extends SendBaseMessage {

	public ResourceMessage(Map<Integer, Resource> resourceMap) {
		super(ServerOpcode.RESOURCE);
		writeByte(resourceMap.size());
		for (Resource resource : resourceMap.values()) {
			writeInt(resource.getItemId());
			writeInt(resource.getResourceNum());
		}
	}

	public ResourceMessage(Resource resource) {
		super(ServerOpcode.RESOURCE);
		writeByte(1);
		writeInt(resource.getItemId());
		writeInt(resource.getResourceNum());

	}
}
